﻿    <tr>
    <td class="TDLabel">国家：</td>
    <td colspan="2">
<{ if $sAction==$ACTION_VIEW }>
<{ $aCountryOption[$sCountrySelect] }>
<{ else }>
    <Select name="strCountryID" size="1"  style="width:50%;"
        onchange="selectLocal('GET_PROVINCE_LIST',this.value,ff.strProvinceID);">
        <{ html_options options=$aCountryOption selected=$sCountrySelect }>
        </Select><{ getRedStar }>
<{ /if }>
    </td>
    </tr>
    <tr>
    <td class="TDLabel">省份：</td>
    <td colspan="2">
<{ if $sAction==$ACTION_VIEW }>
<{ $aProvinceOption[$sProvinceSelect] }>
<{ else }>
    <Select name="strProvinceID" size="1" style="width:50%;"
         onchange="selectLocal('GET_CITY_LIST',this.value,ff.strCityID);">
        <option value="">请选择</option>
        <{ html_options options=$aProvinceOption selected=$sProvinceSelect }>
    </Select><{ getRedStar }>
<{ /if }>
    </td>
    </tr>
    <tr>
    <td class="TDLabel">城市：</td>
    <td colspan="2">
<{ if $sAction==$ACTION_VIEW }>
<{ $aCityOption[$sCitySelect] }>
<{ else }>
    <Select name="strCityID" size="1" style="width:50%;"
         onchange="selectLocal('GET_COUNTY_LIST',this.value,ff.strCountyID);">
        <option value="">请选择</option>
        <{ html_options options=$aCityOption selected=$sCitySelect }>
    </Select><{ getRedStar }>
<{ /if }>
    </td>
    </tr>
    <tr> 
    <td class="TDLabel">区县：</td>
    <td colspan="2">
<{ if $sAction==$ACTION_VIEW }>
<{ $aCountyOption[$sCountySelect] }>
<{ else }>
    <Select name="strCountyID" size="1" style="width:50%;">
        <option value="">请选择</option>
        <{ html_options options=$aCountyOption selected=$sCountySelect }>
    </Select>
<script language="JavaScript">
<!--
function selectLocal(sAction,sSelValue,strSelect) {
    var sUrl="strAction="+sAction;
    var sOptionList,sTemp,sElement,i;
    
    if (sAction == "GET_PROVINCE_LIST") {
        sUrl += "&strCode=" + sSelValue;
        for (i=ff.strCityID.length-1; i>=1;i--){
            ff.strCityID.options.remove(i);
        }
        for (i=ff.strCountyID.length-1; i>=1;i--){
            ff.strCountyID.options.remove(i);
        }
    } else if (sAction == "GET_CITY_LIST") {
        sUrl += "&strProvinceID=" + sSelValue;
        for (i=ff.strCountyID.length-1; i>=1;i--){
            ff.strCountyID.options.remove(i);
        }
    } else if (sAction == "GET_COUNTY_LIST") {
        sUrl += "&strCityID=" + sSelValue;
    } else {
        return false;
    }
    //delete old option at first
    for (i=strSelect.length-1; i>=1;i--){
        strSelect.options.remove(i);
    }

    send_request("./checkAjax.php",sUrl,checkRequest);
    if (http_return) {
        sOptionList = http_return.split("#");
        for (i=0; i<sOptionList.length; i++) {
            sTemp = sOptionList[i].split("@");
            sElement = document.createElement("OPTION");
            sElement.text  = sTemp[1];
            sElement.value = sTemp[0];
            strSelect.add(sElement);    
        }
    }
}
//-->
</script>
<{ /if }>
    </td>
    </tr>
